// 并集∪
function union(s1, s2) {
    return new Set([...s1, ...s2]);
}

// 交集 ∩
function intersection(s1, s2) {
    return [...s1].filter(item => s2.has(item));
}

// 差集 
function substract(s1, s2) {
    return [...s1].filter(item => !s2.has(item));
}

{
    let s1 = new Set([1, 2, 3, 4]);
    let s2 = new Set([4, 5, 6]);

    console.log(s1, s2);
    console.log(union(s1, s2));
    console.log(intersection(s1, s2));
    console.log(substract(s1, s2));
}

{
    let s1 = new Set(['A', 'B', 'C', 4]);
    let s2 = new Set([4, 5, 6]);

    console.log(s1, s2);
    console.log(union(s1, s2));
    console.log(intersection(s1, s2));
    console.log(substract(s1, s2));
}